package org.openstock.impl.def.core.lifecycle;

import java.util.List;

import javax.swing.SwingUtilities;

import org.openstock.design.Registerable;
import org.openstock.impl.def.core.factory.Factory;
import org.openstock.impl.def.core.ui.swing.widget.MainFrame;

public class MainClass {

	public static void main(String[] args) {
		Runtime.getRuntime().addShutdownHook(Factory.getSingleton(ShutdownHook.class));
		SwingUtilities.invokeLater(new Runnable(){
			public void run() {
				MainFrame.getInstance().construct();
				startup();
			}
		});
	}
	
	private static void startup(){
		List<Registerable> registerables = Factory.getImplimentations(Registerable.class);
		if(registerables != null && !registerables.isEmpty()){
			for(Registerable registerable : registerables){
				registerable.register();
			}
		}
	}
	
	private void setup(){
		
	}
	
	

}
